function Animal() {
  this.info = {
    name: "animal",
  };
}

Animal.prototype.can = function () {
  console.log("sleep");
};

function Cat() {
  this.like = "eat";
  Animal.call(this, "miao");
}

function objectCopy(obj) {
  function Fun() {}
  Fun.prototype = obj;
  return new Fun();
}

function inheritPrototype(child, parent) {
  let prototype = objectCopy(parent.prototype);
  prototype.constructor = child;
  child.prototype = prototype;
}

inheritPrototype(Cat, Animal);

// Cat.prototype = new Animal();
// let cat = new Cat();
// let cat2 = new Cat();

// cat.info.name = "lang";
// cat.can();
// console.log(cat2.info.name);
